﻿Imports System.Windows.Threading
Imports System.Threading.Tasks
Imports System.Threading

Public Class SplashScreen
    WithEvents timer As New DispatcherTimer
    Dim t As task

    Private Shared InitCompleted As AsyncCallback
    Private Shared result As IAsyncResult

    Public Sub New()
        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()

        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.

    End Sub

    Private Sub Window_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        Me.Resources.MergedDictionaries.Add(Dictionaries.GetDialogeLocalization)
        Try
            Label2.Content = FindResource("Version") + " " + Window1.Version.ToString("0.00").Replace(",", ".")
        Catch ex As Exception
            Label2.Content = "Version " + Window1.Version.ToString("0.00").Replace(",", ".")
        End Try
        InitCompleted = AddressOf _initCompleted

        result = My.Application.dLoadSplash.BeginInvoke(Me, InitCompleted, Nothing)
    End Sub

    Private Sub _initCompleted()
        My.Application.dLoadSplash.EndInvoke(result)
        Dispatcher.BeginInvoke(New Action(AddressOf _closeWindow), Windows.Threading.DispatcherPriority.Normal, Nothing)
    End Sub

    Private Sub _closeWindow()
        Me.Close()
    End Sub
End Class
